New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[parser] Better error message for missing number exponent #12072
Conversation
@@ -71,6 +71,8 @@ export const ErrorMessages = Object.freeze({ | |||
InvalidLhs: "Invalid left-hand side in %0", | |||
InvalidLhsBinding: "Binding invalid left-hand side in %0", | |||
InvalidNumber: "Invalid number", | |||
InvalidOrMissingExponent: | |||
"Invalid or Missing exponent after 'e' in floating-point number", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Could you just make this lowercase? (don't use GH's "Apply changes" button because you need to regenerate the tests locally)
"Invalid or Missing exponent after 'e' in floating-point number", | |
"Invalid or missing exponent after 'e' in floating-point number", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or maybe just delete "Invalid or", I don't have a preference in either direction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I think we can drop "Invalid or" or:
"Floating-point numbers require a valid exponent after the 'e'."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nicolo-ribaudo , what do you think if I work around and throw accordingly by figuring out if it is actually missing or invalid?
For example: 3ea
would also throw with the same error message. I would consider, it (3ea
) is invalid, that's why I used "invalid"...
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/29948/ |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 4d5ef93:
|
I still prefer:
|
Whops, GH is collapsing the inline discussion and I didn't remember about it 😅
@iamfotx Anything we can do to help get this landed? Looks like we just need to change the error message. |
(adding to the milestone so we don't forget to merge when the tests pass) |
The failing test is also failing in |
* Install babel/parser 7.12 * Add tests for babel/babel#12161 * Add test for babel/babel#12076 * Add test for babel/babel#12085 * Add test for babel/babel#12108 * Add test for babel/babel#12120 * Add test for babel/babel#12054 * Add test for babel/babel#12061 * Add test babel/babel#12093 * Add test for babel/babel#12065 * Add test for babel/babel#12111 * Add test for babel/babel#12072 * Switch syntax-module-attributes to syntax-import-assertion * Support "String import/export specifier" * Remove tests for module-attributes * Add changelog * Update to 7.12.3 * Fix by linter * Fix by spellchecker * Add tests for module attributes to errors * Add error test for module string name with import * Remove TSTypeCastExpression * Add tests for funny import-assertions * Update snapshots| * Add more tests
fix(babel-parser) better error message for missing number exponent